package Demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 殇
 * Date: 2025-07-12
 * Time: 17:17
 */
public class OuterClass2 {
    public int x=10;
    public static int y=20;
    public void fun1(){
        OuterClass2.InnerClass innerClass2=new OuterClass2().new InnerClass();
        System.out.println(innerClass2.z);
    }

    class InnerClass{
        public int x=20;
        public int z=30;
        public void fun2(){
            System.out.println(x);
            System.out.println(OuterClass2.this.x);
        }
    }

    public static void main(String[] args) {
        OuterClass2 outerClass2=new OuterClass2();
        OuterClass2.InnerClass innerClass1=outerClass2.new InnerClass();

        OuterClass2.InnerClass innerClass2=new OuterClass2().new InnerClass();

        outerClass2.fun1();
        innerClass2.fun2();
    }
}
